package com.example.litingting.adapterdemo;

import android.app.ListActivity;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by litingting on 2016/3/21.
 */
public class NewsListActivity extends ListActivity {
    private List<News> data = new ArrayList<News>();
    private void init(){
        News new1 = new News("T1","c1",R.drawable.a1);
        News new2 = new News("T2","c2",R.drawable.a2);
        News new3 = new News("T3","c3",R.drawable.a3);
        data.add(new1);data.add(new2);data.add(new3);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
        MyAdapter adapter = new MyAdapter(this,data);
        setListAdapter(adapter);
    }
}
